import React, { useEffect, useState } from 'react'
import Table from '../../comdy/table/Index'
import Jg from '../../comdy/jg/Index'
import { useParams } from 'react-router-dom'
import instance from '../../axios/instance'
import './detail2.css'

function Index() {
    const { id } = useParams()
    const [detail2Data, setDetail2Data] = useState({})

    useEffect(() => {
        instance.get('/health/share/knowledgeBase/v1/findDrugsKnowledge', {
            params: { id: id }
        }).then(res => {
            console.log('resbzId', res)
            if (res.status === 200) {
                setDetail2Data(res.data.result)
            }
        })
    }, [])
    return (
        <div>
            <Table></Table>
            <Jg></Jg>
            <h2>{detail2Data.name}</h2>
            <div className='de2'>
                <div>
                    <p className='ys'>【药品成分】</p>
                    <p>{detail2Data.component}</p>
                </div>
                <div>
                    <p className='ys'>【用药禁忌】</p>
                    <p>{detail2Data.taboo}</p>
                </div>
                <div>
                    <p className='ys'>【功能主治】</p>
                    <p>{detail2Data.effect}</p>
                </div>
                <div>
                    <p className='ys'>【用法用量】</p>
                    <p>{detail2Data.usage}</p>
                </div>
                <div>
                    <p className='ys'>【药品形状】</p>
                    <p>{detail2Data.shape}</p>
                </div>
                <div>
                    <p className='ys'>【包装规格】</p>
                    <p>{detail2Data.packing}</p>
                </div>
                <div>
                    <p className='ys'>【不良反应】</p>
                    <p>{detail2Data.sideEffects}</p>
                </div>
                <div>
                    <p className='ys'>【贮藏方法】</p>
                    <p>{detail2Data.storage}</p>
                </div>
                <div>
                    <p className='ys'>【注意事项】</p>
                    <p>{detail2Data.minMatter}</p>
                </div>
            </div>
        </div>
    )
}

export default Index
